let App = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    userInfo: {},
    orderCount: {},
    myTopDatainf: {},
    role_id: '',
    site:'',
    is_shangji:''
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  //带看审核跳转
  handleToAllreport() {
    wx.navigateTo({
      url: '../all-reports/all-report',
    })
  },

  //明细跳转
  handleToDetail(e) {
    let type = e.currentTarget.dataset.type
    // console.log(e)
    wx.navigateTo({
      url: `../user-detail/index?type=${type}`,
    })
  },
  //明细跳转
  handleToDetail2(e) {
    let type = e.currentTarget.dataset.type
    // console.log(e)
    wx.navigateTo({
      url: `../user-detail2/index`,
    })
  },
  //即将跟进的
  handleWillTo() {
    wx.navigateTo({
      url: '../user-detail3/index',
    })
  },
  //没有跟进时间的
  handleNoTimeTo() {
    wx.navigateTo({
      url: '../user-detail4/index',
    })
  },
  //带看审核跳转
  handleTakelook() {
    wx.navigateTo({
      url: '../userlook-list/takelook',
    })
  },
  //成交审核跳转
  handleDeallook() {
    wx.navigateTo({
      url: '../userlook-list/deallook',
    })
  },
  //协访审核跳转
  handleInterviewlook() {
    wx.navigateTo({
      url: '../userlook-list/interviewlook',
    })
  },
  //个人成交审核列表跳转
  handleToDealList() {
    wx.navigateTo({
      url: '../personal-deal-list/index',
    })
  },

  //修改密码
  handlePassword() {
    wx.navigateTo({
      url: '../user-password/index',
    })
  },

  // handleToTher(e) {
  //   let type = e.currentTarget.dataset.type
  //   wx.navigateTo({
  //     url: `../look-check/index?type=${type}`,
  //   })
  // },
  //团队排行跳转
  handleToTeam() {
    wx.navigateTo({
      url: '../team-rank/index',
    })
  },
  //个人排行跳转
  handleToPerson() {
    wx.navigateTo({
      url: '../person-rank/index',
    })
  },
  handleToYun(){
    // wx.navigateTo({
    //   url: '../../packageA/pages/franchisee/index/index',
    // })

      wx.reLaunch({
        url: '../../packageA/pages/franchisee/index/index',
      })
  },
  handleToJia(){
    let role_id = wx.getStorageSync('role_id');
    if(role_id == 22 ){
      wx.reLaunch({
        url: '../../packageA/pages/operate/index/secondindex',
      })
    }else{
      wx.reLaunch({
        url: '../../packageA/pages/operate/index/index',
      })
    }
  },
  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    // 获取当前用户信息
    // this.getUserDetail();
    //this.getUserActiveNUm();
    this.myTopData()
    this.setData({
      role_id: wx.getStorageSync('role_id'),
      site: wx.getStorageSync('site'),
      is_shangji: wx.getStorageSync('is_shangji')
    })
  },

  /**
 * 获取列表数据
 */
  myTopData() {
    let _this = this
    App._post_form('member/myTopData', {}, function (result) {
      _this.setData({
        myTopDatainf: result.data,
      })
      console.log(_this.data.myTopDatainf)
    });
  },

  // 退出登陆
  lgoinout: function () {
    var token = wx.getStorageSync('token');
    App._post_form('login/login_out', {
      token: token
    }, function (result) {
      console.log(result);
      // 删除记录
      wx.removeStorageSync('token');
      wx.removeStorageSync('mem_id');
      wx.removeStorageSync('role_id');
      wx.redirectTo({
        url: '../login/login',
      })
    }, false, function () {
      wx.hideLoading();
    });
  },
  /**
   * 下拉刷新
   */
  onPullDownRefresh: function () {
    // 获取首页数据
    this.onShow()
  },
})